home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Amiga Forever MenuBox Launcher */ /* Copyright 2002-2004 Cloanto Corporation */ /* Home Page: www.amigaforever.com */ /* Amiga Forever version */ var af_version_internal = "600" /* Amiga Forever internal version */ var af_version_display = "6.0" /* Amiga Forever display version */ /* Amiga Forever MenuBox launcher language (defined later) */ var afm_language_system; /* system language */ var afm_language_display; /* language actually used */ /* MenuBox configuration override settings (for testing purposes) */ var afm_test_product = "auto"; /* "auto" or product code (mbdemo|special|online|premium) to override software detection and force its feature not installed descriptions and URLs */ var afm_test_language = "auto"; /* "auto" or to two-letter language code to override automatic language detection */ var afm_debug_messages = 1; /* 1 enables display of warning and error messages */ /* directories and files checked to determine configuration */ var condition_runfrommedium = "..\\Setup\\Setup.exe"; /* determines whether product can be installed or not */ var condition_onlinepluspack = "..\\..\\Audio\\playlist.m3u"; /* determines whether Online Plus Pack add-on is installed */ var condition_games = "..\\..\\Emulation\\shared\\hdf\\games\\af-games-01.hdf"; /* determines whether games are installed */ var condition_level_atleastspecial = "..\\..\\Emulation\\shared\\rom\\amiga-os-130.rom"; /* if not even this is present we are running a MenuBox demo */ var condition_level_atleastonline = "..\\..\\Emulation\\shared\\rom\\amiga-os-310.rom"; /* if this is present we have at least an Online Edition (which includes both 1.3 and 3.1 ROMs) */ var condition_level_premium = "..\\..\\Emulation\\shared\\dir\\Work\\Software\\PPaint\\H\\2\\Register.pprx"; /* we are running a Premium (CD or DVD) version, either from medium or installed */ /* other global variables */ var max_tabs = 4; var max_items = 7; var afm_tab_current = 0; /* current MenuBox tab (1-4, with 0 meaning no current selection) */ var afm_tab_gfx_current = 0; /* current visually selected MenuBox tab (1-4, with 0 meaning no current selection) */ var afm_tab_pointer_current = 0; /* current MenuBox tab with hand mouse pointer (1-4, with 0 meaning no current selection) */ var afm_item_current = 0; /* current MenuBox item (1-7, with 0 meaning no current selection) */ var afm_tab_type_general = 1; var afm_tab_type_gallery = 2; var afm_tab_type_videos = 3; var afm_tab_type_games = 4; var afm_preview_description_pending = 0; /* 1 while a second preview-description text is pending (otherwise we could clear before the actual write) */ var afm_window_title = "Amiga Forever"; /* MenuBox browser container window title */ var afm_tabs_initialized = 0; /* 0, or 1-4 as initialization progresses */ var afm_tab_changing_step = 0; /* 0, or 1-4 as rebuild progresses */ var items_a = new Array(max_tabs); /* number of items in this tab */ var title_a = new Array(max_tabs); /* array of current item title texts */ var image_a = new Array(max_tabs); /* array of current item images */ var condition_a = new Array(max_tabs); /* array of current item conditions (to display description text or "nofeature" text) */ var description_a = new Array(max_tabs); /* array of current item description texts */ var featurepresent_a = new Array(max_tabs); /* array of current item feature condition check results */ var action_type_a = new Array(max_tabs); /* array of current item action types */ var action_file_a = new Array(max_tabs); /* array of current item action files or urls */ var action_params_a = new Array(max_tabs); /* array of current item action parameters */ var action_dir_a = new Array(max_tabs); /* array of current item action directories */ for (i=0; i < max_tabs; i++) { items_a[i] = 0; title_a[i] = new Array(max_items); image_a[i] = new Array(max_items); condition_a[i] = new Array(max_items); description_a[i] = new Array(max_items); featurepresent_a[i] = new Array(max_items); action_type_a[i] = new Array(max_items); action_file_a[i] = new Array(max_items); action_params_a[i] = new Array(max_items); action_dir_a[i] = new Array(max_items); } /* let's check the product type */ /* mbdemo : MenuBox launcher/demo only (no ROM, OS or emulation files) */ /* special: Special Edition with limited (1.3 only) ROM/OS content */ /* online : Online Edition, with 1.3 and 3.X ROMs and OS */ /* premium: fullest version, non-downloadable, with run-from-installation-medium capability */ /* this information is placed in the URL so that the appropriate upgrade information can be displayed by the web server */ var af_product = "mbdemo"; if (afm_test_product == "auto") { if (menubox_exists(condition_level_premium)) af_product = "premium"; else if (menubox_exists(condition_level_atleastonline)) af_product = "online"; else if (menubox_exists(condition_level_atleastspecial)) af_product = "special"; } else af_product = afm_test_product; /* see if installed (i.e. one with run-from-medium vs. run-after-installation) */ /* in theory only the Premium Edition should have the setup files on the run-from-medium set of files */ /* this affects items like "install" vs. "check for updates" in the first tab */ var af_installed = 1; if (menubox_exists(condition_runfrommedium)) af_installed = 0; /* check if the Plus Pack files are installed */ /* in theory the videos on the Premium Edition medium are better than the MP3s on the Plus Pack, but if they are installed let's list them */ var af_onlinepluspack = 0; if (menubox_exists(condition_onlinepluspack)) af_onlinepluspack = 1; /* check if games are installed (they may be missing in some markets, due to local rating regulations) */ var af_games = 0; if (menubox_exists(condition_games)) af_games = 1; /* set MenuBox window title */ afm_window_title = afm_window_title + " " + af_version_display; if (af_product == "mbdemo") afm_window_title = afm_window_title + " Demo"; if (af_product == "special") afm_window_title = afm_window_title + " SE"; if (af_product == "online") { afm_window_title = afm_window_title + " Online Edition"; if (af_onlinepluspack) afm_window_title = afm_window_title + "& Plus Pack"; } menubox_title(afm_window_title); /* set language resources and set dynamic not available/update texts and URLs */ af_localize(); /* we only differentiate between general and games (which may be special due to local rating regulations), not for each tab */ var txt_nofeature_general = lcl_txt_nofeature_notinstalled; var url_nofeature_general = "http://www.amigaforever.com"; var txt_nofeature_games = lcl_txt_nofeature_games; var url_nofeature_games = "http://www.amigaforever.com/download/games/"; /* set currently displayed texts */ var txt_nofeature_current_general = lcl_txt_nofeature_inprogress; var url_nofeature_current_general = url_nofeature_general; var txt_nofeature_current_games = txt_nofeature_current_general; var url_nofeature_current_games = url_nofeature_current_general; if (af_product != "premium") { /* various buy/upgrade options */ url_nofeature_general = url_nofeature_general + "/shop/"; if (af_product == "mbdemo") txt_nofeature_general = lcl_txt_nofeature_buy; else if (af_product == "special" || af_product == "online") { txt_nofeature_general = lcl_txt_nofeature_upgrade; } } url_nofeature_general = url_nofeature_general + "?ref=" + af_product + "&ver=" + af_version_internal + "&langsys=" + afm_language_system + "&langmb=" + afm_language_display; if (af_product != "premium" || af_games) { /* only Premium Edition with no games has special text/action */ txt_nofeature_games = txt_nofeature_general; url_nofeature_games = url_nofeature_general; } /* initialize data for all tabs */ function af_initialize() { var item_offset = 0; /* used when items are conditionally inserted (e.g. Plus Pack files) */ /* tab 1 */ if (af_product == "special") item_offset = 1; /* let's swap 1.3 and 3.X, so the available version comes first */ title_a[0][item_offset+0] = lcl_txt_t1_amigaos3x_title; image_a[0][item_offset+0] = "screen-afwb-3x.gif"; condition_a[0][item_offset+0] = "..\\..\\Emulation\\shared\\rom\\amiga-os-310.rom"; description_a[0][item_offset+0] = lcl_txt_t1_amigaos3x_descr; action_type_a[0][item_offset+0] = "execute"; action_file_a[0][item_offset+0] = "WinUAE.exe"; if (af_version_internal < "600") /* legacy version of Amiga Forever */ action_params_a[0][item_offset+0] = "-config=Configurations\\31+.uae"; else action_params_a[0][item_offset+0] = "-config=Configurations\\af_3x.uae"; action_dir_a[0][item_offset+0] = "..\\..\\Emulation\\WinUAE"; if (af_product == "special") item_offset = -1; title_a[0][item_offset+1] = lcl_txt_t1_amigaos13_title; image_a[0][item_offset+1] = "screen-afwb-13.gif"; condition_a[0][item_offset+1] = "..\\..\\Emulation\\shared\\rom\\amiga-os-130.rom"; description_a[0][item_offset+1] = lcl_txt_t1_amigaos13_descr; action_type_a[0][item_offset+1] = "execute"; action_file_a[0][item_offset+1] = "WinUAE.exe"; if (af_version_internal < "600") /* legacy version of Amiga Forever */ action_params_a[0][item_offset+1] = "-config=Configurations\\13+.uae"; else action_params_a[0][item_offset+1] = "-config=Configurations\\a500+2mb_13.uae"; action_dir_a[0][item_offset+1] = "..\\..\\Emulation\\WinUAE"; item_offset = 0; title_a[0][item_offset+2] = lcl_txt_t1_winuaeconfig_title; image_a[0][item_offset+2] = "screen-winuae.gif"; condition_a[0][item_offset+2] = "..\\..\\Emulation\\WinUAE\\WinUAE.exe"; description_a[0][item_offset+2] = lcl_txt_t1_winuaeconfig_descr; action_type_a[0][item_offset+2] = "execute"; action_file_a[0][item_offset+2] = "WinUAE.exe"; action_params_a[0][item_offset+2] = "-s use_gui=yes"; action_dir_a[0][item_offset+2] = "..\\..\\Emulation\\WinUAE"; title_a[0][item_offset+3] = lcl_txt_t1_winfellowconfig_title; image_a[0][item_offset+3] = "screen-winfellow.gif"; condition_a[0][item_offset+3] = "..\\..\\Emulation\\WinFellow\\WinFellow.exe"; description_a[0][item_offset+3] = lcl_txt_t1_winfellowconfig_descr; action_type_a[0][item_offset+3] = "execute"; action_file_a[0][item_offset+3] = "WinFellow.exe"; action_params_a[0][item_offset+3] = ""; action_dir_a[0][item_offset+3] = "..\\..\\Emulation\\WinFellow"; title_a[0][item_offset+4] = lcl_txt_t1_documentation_title; image_a[0][item_offset+4] = "screen-webbrowser.gif"; description_a[0][item_offset+4] = lcl_txt_t1_documentation_descr; action_type_a[0][item_offset+4] = "execute"; action_file_a[0][item_offset+4] = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_documentation; if (af_version_internal < "600") /* legacy version of Amiga Forever */ action_file_a[0][item_offset+4] = "..\\..\\Documentation\index.html"; else action_file_a[0][item_offset+4] = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_documentation; condition_a[0][item_offset+4] = action_file_a[0][item_offset+4]; action_params_a[0][item_offset+4] = ""; action_dir_a[0][item_offset+4] = ""; if (af_installed) { title_a[0][item_offset+5] = lcl_txt_t1_browsedir_title; image_a[0][item_offset+5] = "screen-browse.gif"; condition_a[0][item_offset+5] = "..\\..\\"; description_a[0][item_offset+5] = lcl_txt_t1_browsedir_descr; action_type_a[0][item_offset+5] = "execute"; action_file_a[0][item_offset+5] = "..\\..\\"; action_params_a[0][item_offset+5] = ""; action_dir_a[0][item_offset+5] = ""; title_a[0][item_offset+6] = lcl_txt_t1_updates_title; image_a[0][item_offset+6] = "screen-updates.gif"; condition_a[0][item_offset+6] = "..\\Software Manager\\softmcmd.exe"; description_a[0][item_offset+6] = lcl_txt_t1_updates_descr; action_type_a[0][item_offset+6] = "execute"; action_file_a[0][item_offset+6] = "softmcmd.exe"; action_params_a[0][item_offset+6] = "/cn"; action_dir_a[0][item_offset+6] = "..\\Software Manager"; } else { title_a[0][item_offset+5] = lcl_txt_t1_browsemedium_title; image_a[0][item_offset+5] = "screen-browse.gif"; condition_a[0][item_offset+5] = "..\\..\\"; description_a[0][item_offset+5] = lcl_txt_t1_browsemedium_descr; action_type_a[0][item_offset+5] = "execute"; action_file_a[0][item_offset+5] = "..\\..\\"; action_params_a[0][item_offset+5] = ""; action_dir_a[0][item_offset+5] = ""; title_a[0][item_offset+6] = lcl_txt_t1_install_title; image_a[0][item_offset+6] = "screen-browse.gif"; condition_a[0][item_offset+6] = "..\\Setup\\Setup.exe"; description_a[0][item_offset+6] = lcl_txt_t1_install_descr; action_type_a[0][item_offset+6] = "execute"; action_file_a[0][item_offset+6] = "Setup.exe"; action_params_a[0][item_offset+6] = ""; action_dir_a[0][item_offset+6] = "..\\Setup"; } items_a[0] = item_offset+7; /* tab 2 */ item_offset = 0; if (af_onlinepluspack) { title_a[1][item_offset+0] = lcl_txt_t2_pluspack_title; image_a[1][item_offset+0] = "screen-webbrowser.gif"; condition_a[1][item_offset+0] = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_pluspack; description_a[1][item_offset+0] = lcl_txt_t2_pluspack_descr; action_type_a[1][item_offset+0] = "execute"; action_file_a[1][item_offset+0] = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_pluspack; action_params_a[1][item_offset+0] = ""; action_dir_a[1][item_offset+0] = ""; item_offset = 1; } title_a[1][item_offset+0] = lcl_txt_t2_byte_title; image_a[1][item_offset+0] = "1985-amiga-byte.gif"; condition_a[1][item_offset+0] = "..\\..\\Gallery\\1985-amiga-byte.tif"; description_a[1][item_offset+0] = lcl_txt_t2_byte_descr; action_type_a[1][item_offset+0] = "execute"; action_file_a[1][item_offset+0] = "..\\..\\Gallery\\1985-amiga-byte.tif"; action_params_a[1][item_offset+0] = ""; action_dir_a[1][item_offset+0] = ""; title_a[1][item_offset+1] = lcl_txt_t2_a1000_title; image_a[1][item_offset+1] = "1985-a1000-cover.gif"; condition_a[1][item_offset+1] = "..\\..\\Gallery\\1985-a1000-cover.png"; description_a[1][item_offset+1] = lcl_txt_t2_a1000_descr; action_type_a[1][item_offset+1] = "execute"; action_file_a[1][item_offset+1] = "..\\..\\Gallery\\1985-a1000-cover.png"; action_params_a[1][item_offset+1] = ""; action_dir_a[1][item_offset+1] = ""; title_a[1][item_offset+2] = lcl_txt_t2_patent_title; image_a[1][item_offset+2] = "1985-patent-4777621.gif"; condition_a[1][item_offset+2] = "..\\..\\Gallery\\1985-patent-4777621.tif"; description_a[1][item_offset+2] = lcl_txt_t2_patent_descr; action_type_a[1][item_offset+2] = "execute"; action_file_a[1][item_offset+2] = "..\\..\\Gallery\\1985-patent-4777621.tif"; action_params_a[1][item_offset+2] = ""; action_dir_a[1][item_offset+2] = ""; title_a[1][item_offset+3] = lcl_txt_t2_home_title; image_a[1][item_offset+3] = "screen-webbrowser.gif"; condition_a[1][item_offset+3] = ""; description_a[1][item_offset+3] = lcl_txt_t2_home_descr; action_type_a[1][item_offset+3] = "url"; action_file_a[1][item_offset+3] = "http://www.amigaforever.com/gallery/"; action_params_a[1][item_offset+3] = ""; action_dir_a[1][item_offset+3] = ""; items_a[1] = item_offset+4; /* tab 3 */ item_offset = 0; title_a[2][item_offset+0] = lcl_txt_t3_1985nylaunchamiga_title; image_a[2][item_offset+0] = "1985-nylaunch-amiga.gif"; condition_a[2][item_offset+0] = "..\\..\\Video\\1985-nylaunch-amiga.wmv"; description_a[2][item_offset+0] = lcl_txt_t3_1985nylaunchamiga_descr; action_type_a[2][item_offset+0] = "execute"; action_file_a[2][item_offset+0] = "..\\..\\Video\\1985-nylaunch-amiga.wmv"; action_params_a[2][item_offset+0] = ""; action_dir_a[2][item_offset+0] = ""; title_a[2][item_offset+1] = lcl_txt_t3_1989jayminermetcom_title; image_a[2][item_offset+1] = "1989-jayminer-metcom.gif"; condition_a[2][item_offset+1] = "..\\..\\Video\\1989-jayminer-metcom.wmv"; description_a[2][item_offset+1] = lcl_txt_t3_1989jayminermetcom_descr; action_type_a[2][item_offset+1] = "execute"; action_file_a[2][item_offset+1] = "..\\..\\Video\\1989-jayminer-metcom.wmv"; action_params_a[2][item_offset+1] = ""; action_dir_a[2][item_offset+1] = ""; title_a[2][item_offset+2] = lcl_txt_t3_1990jayminercloanto_title; image_a[2][item_offset+2] = "1990-jayminer-cloanto.gif"; condition_a[2][item_offset+2] = "..\\..\\Video\\1990-jayminer-cloanto.wmv"; description_a[2][item_offset+2] = lcl_txt_t3_1990jayminercloanto_descr; action_type_a[2][item_offset+2] = "execute"; action_file_a[2][item_offset+2] = "..\\..\\Video\\1990-jayminer-cloanto.wmv"; action_params_a[2][item_offset+2] = ""; action_dir_a[2][item_offset+2] = ""; title_a[2][item_offset+3] = lcl_txt_t3_1994deathbeddavehaynie_title; image_a[2][item_offset+3] = "1994-deathbed-davehaynie.gif"; condition_a[2][item_offset+3] = "..\\..\\Video\\1994-deathbed-davehaynie.wmv"; description_a[2][item_offset+3] = lcl_txt_t3_1994deathbeddavehaynie_descr; action_type_a[2][item_offset+3] = "execute"; action_file_a[2][item_offset+3] = "..\\..\\Video\\1994-deathbed-davehaynie.wmv"; action_params_a[2][item_offset+3] = ""; action_dir_a[2][item_offset+3] = ""; title_a[2][item_offset+4] = lcl_txt_t3_home_title; image_a[2][item_offset+4] = "screen-webbrowser.gif"; condition_a[2][item_offset+4] = ""; description_a[2][item_offset+4] = lcl_txt_t3_home_descr; action_type_a[2][item_offset+4] = "url"; action_file_a[2][item_offset+4] = "http://www.amigaforever.com/videos/"; action_params_a[2][item_offset+4] = ""; action_dir_a[2][item_offset+4] = ""; items_a[2] = item_offset+5; /* tab 4 */ item_offset = 0; title_a[3][item_offset+0] = lcl_txt_t4_deluxegalaga_title; image_a[3][item_offset+0] = "game-deluxegalaga.gif"; condition_a[3][item_offset+0] = "..\\..\\Emulation\\shared\\adf\\games\\deluxegalaga.adf"; description_a[3][item_offset+0] = lcl_txt_t4_deluxegalaga_descr; action_type_a[3][item_offset+0] = "execute"; action_file_a[3][item_offset+0] = "WinUAE.exe"; action_params_a[3][item_offset+0] = "-config=Configurations\\games\\deluxegalaga.uae"; action_dir_a[3][item_offset+0] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+1] = lcl_txt_t4_hilt2_title; image_a[3][item_offset+1] = "game-hilt2.gif"; condition_a[3][item_offset+1] = "..\\..\\Emulation\\shared\\adf\\games\\hilt2-1.adf"; description_a[3][item_offset+1] = lcl_txt_t4_hilt2_descr; action_type_a[3][item_offset+1] = "execute"; action_file_a[3][item_offset+1] = "WinUAE.exe"; action_params_a[3][item_offset+1] = "-config=Configurations\\games\\hilt2.uae"; action_dir_a[3][item_offset+1] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+2] = lcl_txt_t4_mindwalker_title; image_a[3][item_offset+2] = "game-mindwalker.gif"; condition_a[3][item_offset+2] = "..\\..\\Emulation\\shared\\adf\\games\\mindwalker.adf"; description_a[3][item_offset+2] = lcl_txt_t4_mindwalker_descr; action_type_a[3][item_offset+2] = "execute"; action_file_a[3][item_offset+2] = "WinUAE.exe"; action_params_a[3][item_offset+2] = "-config=Configurations\\games\\mindwalker.uae"; action_dir_a[3][item_offset+2] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+3] = lcl_txt_t4_portsofcall_title; image_a[3][item_offset+3] = "game-portsofcall.gif"; condition_a[3][item_offset+3] = "..\\..\\Emulation\\shared\\adf\\games\\portsofcall.adf"; description_a[3][item_offset+3] = lcl_txt_t4_portsofcall_descr; action_type_a[3][item_offset+3] = "execute"; action_file_a[3][item_offset+3] = "WinUAE.exe"; action_params_a[3][item_offset+3] = "-config=Configurations\\games\\portsofcall.uae"; action_dir_a[3][item_offset+3] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+4] = lcl_txt_t4_towerofsouls_title; image_a[3][item_offset+4] = "game-towerofsouls.gif"; /* condition_a[3][item_offset+4] = "..\\..\\Emulation\\shared\\hdf\\games\\af-games-01.hdf"; */ condition_a[3][item_offset+4] = "..\\..\\Emulation\\shared\\adf\\games\\towerofsouls-1.adf"; description_a[3][item_offset+4] = lcl_txt_t4_towerofsouls_descr; action_type_a[3][item_offset+4] = "execute"; action_file_a[3][item_offset+4] = "WinUAE.exe"; action_params_a[3][item_offset+4] = "-config=Configurations\\games\\towerofsouls.uae"; action_dir_a[3][item_offset+4] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+5] = lcl_txt_t4_launcher_title; image_a[3][item_offset+5] = "screen-winuae.gif"; condition_a[3][item_offset+5] = "..\\..\\Emulation\\WinUAE\\WinUAE.exe"; description_a[3][item_offset+5] = lcl_txt_t4_launcher_descr; action_type_a[3][item_offset+5] = "execute"; action_file_a[3][item_offset+5] = "WinUAE.exe"; action_params_a[3][item_offset+5] = "-s use_gui=yes"; action_dir_a[3][item_offset+5] = "..\\..\\Emulation\\WinUAE"; title_a[3][item_offset+6] = lcl_txt_t4_home_title; image_a[3][item_offset+6] = "screen-webbrowser.gif"; condition_a[3][item_offset+6] = ""; description_a[3][item_offset+6] = lcl_txt_t4_home_descr; action_type_a[3][item_offset+6] = "url"; action_file_a[3][item_offset+6] = "http://www.amigaforever.com/games/"; action_params_a[3][item_offset+6] = ""; action_dir_a[3][item_offset+6] = ""; items_a[3] = item_offset+7; for (i=0; i < max_tabs; i++) for (j=0; j < items_a[i]; j++) { if (condition_a[i][j] == "") featurepresent_a[i][j] = 1; else featurepresent_a[i][j] = 0; } /* now everything is initialized, in a worst case scenario it will consider features "not present", but at least it will work */ /* the following takes a bit longer */ for (i=0; i < max_tabs; i++) { /* let's enable features which require verification of file existence */ for (j=0; j < items_a[i]; j++) { if (featurepresent_a[i][j] == 0) if (menubox_exists(condition_a[i][j])) featurepresent_a[i][j] = 1; } afm_tabs_initialized = i+1; } /* feature detection is complete, let's use final "no feature" texts, if any */ txt_nofeature_current_general = txt_nofeature_general; url_nofeature_current_general = url_nofeature_general; txt_nofeature_current_games = txt_nofeature_games; url_nofeature_current_games = url_nofeature_games; af_tab_action(1); /* let's display the content of the first tab (it did not like being rendered as part of onload) */ } /* build tab (1, 2, 3 or 4) */ function af_tab_action(tab_position) /* position is 1- */ { if (tab_position < 1 || tab_position > max_tabs) af_alert("Error: Incorrect tab argument."); if (tab_position <= afm_tabs_initialized) { if (afm_tab_changing_step > 0) { afm_tab_current = 0; /* let's make sure nobody accesses whatever was in progress */ af_tab_out(0); af_alert("Warning: Previous tab build did not complete (step "+afm_tab_changing_step+"). This could be caused by low system resources."); } afm_tab_changing_step = 1; /* let's double-check in-tab items */ if (afm_item_current != 0) { af_item_out(afm_item_current); af_alert("Warning: In-tab item still selected during change of tab."); } afm_tab_changing_step = 2; /* tab visual status */ af_tab_gfx_select(tab_position); afm_tab_changing_step = 3; /* let's change the item texts (this is where debug tracing found a non-return condition on low system resources) */ for (i=0; i < items_a[tab_position-1]; i++) { document.all["item-"+(i+1)].innerHTML = title_a[tab_position-1][i]; /* arrays are 0-, active positions are 1- */ } afm_tab_changing_step = 4; /* let's clear any remaining item texts */ for (i = items_a[tab_position-1]; i < max_items; i++) { document.all["item-"+(i+1)].innerHTML = ""; } afm_tab_changing_step = 5; afm_tab_current = tab_position; af_tab_out(tab_position); afm_tab_changing_step = 0; } else af_alert("Warning: Tab content not yet initialized (requested: "+tab_position+", initialized: "+afm_tabs_initialized+", previous step: "+afm_tab_changing_step+")."); } function af_tab_over(tab_position) /* position is 1- */ { if (tab_position != afm_tab_gfx_current && tab_position != afm_tab_pointer_current && tab_position > 0) { if (afm_tab_pointer_current != 0) af_tab_out(afm_tab_pointer_current); document.all["tab-"+tab_position].style.cursor = "hand"; afm_tab_pointer_current = tab_position; } } function af_tab_out(tab_position) /* position is 1- (may be invoked with position 0 to clear whatever was left) */ { if (afm_tab_pointer_current != 0) { if (tab_position != afm_tab_pointer_current) af_tab_out(afm_tab_pointer_current); if (tab_position > 0) document.all["tab-"+tab_position].style.cursor = "default"; afm_tab_pointer_current = 0; } } function af_tab_gfx_select(tab_position) /* position is 1- */ { if (tab_position != afm_tab_gfx_current) { if (afm_tab_gfx_current != 0) { document.images["tab-"+afm_tab_current].src = "gfx/tabs/"+afm_tab_current+"_"+afm_language_display+".gif"; afm_tab_gfx_current = 0; } document.images["tab-"+tab_position].src = "gfx/tabs/"+tab_position+"_"+afm_language_display+"-on.gif"; afm_tab_gfx_current = tab_position; } } function af_item_action(item_position) /* position is 1- (here we don't care of visual status, we just do what we are told we have to do) */ { if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1]) { if (!featurepresent_a[afm_tab_current-1][item_position-1]) { if (afm_tab_current == afm_tab_type_games) menubox_execute(url_nofeature_current_games); /* the games tab may have a different unavailability text/action due to local rating regulations */ else menubox_execute(url_nofeature_current_general); } else if (action_type_a[afm_tab_current-1][item_position-1] == "execute") menubox_execute(action_file_a[afm_tab_current-1][item_position-1],action_params_a[afm_tab_current-1][item_position-1],action_dir_a[afm_tab_current-1][item_position-1]); else if (action_type_a[afm_tab_current-1][item_position-1] == "url") menubox_execute(action_file_a[afm_tab_current-1][item_position-1]); else af_alert("Error: Incorrect action argument: "+item_position+" "+action_type_a[item_position-1]+"."); } } function af_item_over(item_position) /* position is 1- (note: system can call out without matching over, and viceversa) */ { afm_preview_description_pending = 0; /* let's cancel pending second description text, if any */ if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1] && afm_item_current != item_position) { if (afm_item_current != 0) { af_item_out(afm_item_current); af_alert("Warning: Previous item still selected while entering new item."); } if (image_a[afm_tab_current-1][item_position-1] != "") document.images["preview-1"].src = "gfx/preview/"+image_a[afm_tab_current-1][item_position-1]; if (description_a[afm_tab_current-1][item_position-1] != "") { document.all["preview-description"].innerHTML = description_a[afm_tab_current-1][item_position-1]; if (!featurepresent_a[afm_tab_current-1][item_position-1] && !afm_preview_description_pending) { afm_preview_description_pending = 1; setTimeout("af_item_nofeature();",750); } } afm_item_current = item_position; } } function af_item_out(item_position) /* position is 1- (note: system can call out without matching over, and viceversa; system also calls out as part of onclick=action) */ { afm_preview_description_pending = 0; /* let's cancel pending second description text, if any */ if (afm_item_current != item_position && afm_item_current != 0) af_alert("Warning: Moving out of non-current item (old: "+afm_item_current+", new: "+item_position+")."); if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1] && afm_item_current != 0) { document.images["preview-1"].src = "gfx/preview/blank.gif"; document.all["preview-description"].innerHTML = ""; afm_item_current = 0; } /* note: since we don't use a formal semaphore it is in theory possible that rendering of the second description overlaps the above, causing a second text to persist */ } function af_item_nofeature() { if (afm_preview_description_pending) { if (afm_tab_current == afm_tab_type_games) document.all["preview-description"].innerHTML = "<i>"+txt_nofeature_current_games+"</i>"; /* the games tab may have a different unavailability text/action due to local rating regulations */ else document.all["preview-description"].innerHTML = "<i>"+txt_nofeature_current_general+"</i>"; afm_preview_description_pending = 0; } } function af_alert(message) { if (afm_debug_messages) alert(message+" Kindly report this condition to support@cloanto.com."); }